import axios, {type AxiosInstance} from 'axios'

const service: AxiosInstance  = axios.create({
  baseURL: 'http://192.168.182.128:8001/api', // 统一基础地址
  timeout: 10000
})

// 请求拦截器
service.interceptors.request.use(config => {
    return config
})

// 响应拦截器
service.interceptors.response.use(
  response => response.data,
  error => {
    console.error('API Error:', error)
    return Promise.reject(error)
  }
)

export default service